//
//  ViewController.m
//  MarkDown
//
//  Created by Yeekyo on 2016/12/3.
//  Copyright © 2016年 Yeekyo. All rights reserved.
//

#import "ViewController.h"
#import <MMMarkdown/MMMarkdown.h>

@interface ViewController ()<UIWebViewDelegate>

@property (strong, nonatomic) UIWebView *myWebView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    _myWebView = [[UIWebView alloc]initWithFrame:self.view.bounds];
    [self.view addSubview:_myWebView];
    _myWebView.delegate = self;
    
   NSString * path = [[NSBundle mainBundle] pathForResource:@"diudiu" ofType:@"txt"];
    NSURL * fileUrl = [NSURL fileURLWithPath:path];
    NSString * markdownStr = [NSString stringWithContentsOfURL:fileUrl encoding:NSUTF8StringEncoding error:nil];
    //    NSString * htmlString = [MMMarkdown HTMLStringWithMarkdown:markdownStr error:nil];
    NSString * htmlString = [MMMarkdown HTMLStringWithMarkdown:markdownStr extensions:MMMarkdownExtensionsGitHubFlavored error:nil];
    [_myWebView loadHTMLString:htmlString baseURL:nil];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
